home *** CD-ROM | disk | FTP | other *** search
/ Aminet 6 / Aminet 6 - June 1995.iso / Aminet / dev / e / rpmod1v1.lha / Modules / Tools / qsortSL.doc < prev    next >
Encoding:
Text File  |  1995-04-06  |  1.3 KB  |  58 lines

  1.  
  2.     Optimised QuickSort of ARRAY OF signed LONG ( qsortSL.m )
  3.  
  4.     © Richard Perrott 4th April 1995 FreeWare
  5.       email: hcm94rp2@dmu.ac.uk
  6.  
  7.  
  8.   This is a module containing a heavily optimised Quicksort routine
  9. for ARRAY OF LONG ( signed values ), it sort the array in accending
  10. order.
  11.  
  12.   There are 3 ways to call the routine:
  13.  
  14.   1.
  15.     by direct machine code access to the core routine,
  16.     pass two registers to it.
  17.  
  18.         A0 =  the start address of array
  19.         A1 =  the end address of array
  20.  
  21.         BSR    qsortSL_mc
  22.  
  23.           or
  24.  
  25.         JSR    qsortSL_mc
  26.  
  27.  
  28.   2.
  29.     by calling a PROC with the start and end address
  30.     of the array.
  31.  
  32.         PROC qsortSL(first_p,last_p)
  33.  
  34.   3.
  35.     by calling a PROC with the base address of array,
  36.     a start index and an end index.
  37.  
  38.         PROC qsortSLi(base_p,first,last)
  39.  
  40.  
  41. Note:
  42.   All 3 methods save any registers they use, the only exception is
  43. A0 and A1 for qsortSL_mc.
  44.  
  45.   The module contains 184 bytes of assembler / E code.
  46.  
  47.   The routine has been heavily tested, though there are no promises
  48. and I won't be held responsible if you find bugs or you misuse the
  49. routines.
  50.  
  51.   If you do find any bugs then please email me.
  52.  
  53. References:
  54.     Programming and Problem Solving in Modula-2, Sanford Leestma
  55.     & Larry Nyhoff, © Macmillan 1992, USA, page 624-626
  56.  
  57.     ( beware the example in this book for Split() contains some bugs )
  58.